package io.mft.commons.function.response.bean;

import java.util.ArrayList;

import cn.hutool.core.bean.BeanUtil;
import io.mft.commons.function.FunctionResponseType;
import io.mft.commons.function.IFunctionResponse;
import io.mft.commons.function.response.kv.KVMap;
import io.mft.commons.function.response.kv.KVMapList;

public class ObjectBeanList<T> extends ArrayList<T> implements IFunctionResponse {

	/**
	 * @说明：TODO
	 * @字段名称 serialVersionUID
	 */

	private static final long serialVersionUID = 9115585493952605376L;

	@Override
	public FunctionResponseType responseType() {
		return FunctionResponseType.beanList;
	}

	
	public KVMapList toObjectKVMapList() {
		KVMapList objectKVMapList=new KVMapList();
		this.forEach(a->{
			KVMap m=new KVMap();
			BeanUtil.beanToMap(a, m, false, true);
			objectKVMapList.add(m);
		});
		return objectKVMapList;
	}
}
